/***
  // 节流  限定时间内只执行一次
    *  @param {?Number|300} time - 间隔时间

    *  例：<el-button v-throttling="3000">刷新</el-button>
    */
module.exports = {
        bind: (el, binding) => {
          let throttleTime = binding.value; 
          if (!throttleTime||throttleTime==0) {
            // 用户若不设置防抖时间，则默认1.2s
            throttleTime = 1200;
          }
          let cbFun;
          el.addEventListener(
            "click",
            (event) => {
              if (!cbFun) {
                // 第一次执行
                cbFun = setTimeout(() => {
                  cbFun = null;
                }, throttleTime);
              } else {
                event && event.stopImmediatePropagation();
              }
            },
            true
          );
        },
      }
